home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
TextHarvest
/
TextHarvest-Install.exe
/
{app}
/
ScriptSample01.txt
< prev
next >
Wrap
Text File
|
2004-12-01
|
3KB
|
55 lines
;---------------------------------------------------------------------------
; Sample Script for Pinnacle Software's TextHarvest Product
;---------------------------------------------------------------------------
;
; This script was designed for the ThingsToDo.txt sample input file,
; which is included with Pinnacle Software's script-enabled product
; TextHarvest (free download at www.parse-o-matic.com).
;
; It converts the output to CSV (Comma Separated Value) format.
; It also makes some other changes to the outgoing data.
;
; For example, if TextHarvest retains the following line:
; CAT Buy a new cat food bowl
; Then it will be modified to look like this:
; "Cat","Buy a new cat food bowl"
;
;---------------------------------------------------------------------------
; Check TextHarvest settings
;---------------------------------------------------------------------------
Begin FirstRun = '' ; Variables start as nulls
FirstRun = 'N' ; We won't run this block again
InputFileWanted = 'ThingsToDo.txt' ; We'll use this later
X = Len $OptionX $OptionY $OptionZ ; Measure /Keep /Delete /Controls
Begin X <> 0 ; Start of conditional block
M1 = 'Please clear the /Keep /Delete and' $0A$0D ; End with CRLF
M2 = '/Control input boxes and try this' $0A$0D ; End with CRLF
M3 = 'this script again.' ; Last line
Stop M1 M2 M3 ; Stop with error message
End ; End of conditional block
Begin $ActualIFN ~ InputFileWanted ; Check input file
M1 = 'Please try this script with the' $0A$0D
M2 = 'input file' InputFileWanted
Stop M1 M2 ; Stop with error message
End ; End of conditional block
End ; End of conditional block
;---------------------------------------------------------------------------
; Get the category, remove extra spaces, and change case
;---------------------------------------------------------------------------
Category = $OutData[1 9] ; Get columns 1 to 9
TrimChar Category ; Remove spaces on either side
Category = ChangeCase Category 'Hardcaps' ; Capitalize The Text
If Category = 'Car' Category = 'Auto' ; Apply a change to Category
;---------------------------------------------------------------------------
; Get the description. For demonstration purposes, we use the Cols function
; here, but $OutData[10 999] would also work.
;---------------------------------------------------------------------------
Description = Cols $OutData 10 999 ; Get columns 10 to end-of-line
;---------------------------------------------------------------------------
; Send modified information to the output file specified by TextHarvest
;---------------------------------------------------------------------------
Output '"' Category '",' ; Output Category with quotes and comma
OutEnd '"' Description '"' ; Output Description